﻿// JavaScript Document
function AddFavorite(sURL, sTitle)//使用方法：AddFavorite(window.location,document.title)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "/");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
} 


function SetHome(obj,vrl){//使用方法 SetHome(this,window.location);
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        }
                        catch (e) {
                                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入about:config并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}
//m选项卡数目
//n当前选项卡编号
function setTab(m,n){
	var menu=document.getElementById("tab"+m).getElementsByTagName("li");   //获取ID为tab+m标签下的li标签
	var showdiv=document.getElementById("tablist"+m).getElementsByTagName("div");   //获取ID为tablist+m标签下的div标签
	for(i=0;i<menu.length;i++)
	{
		menu[i].className=i==n?"now":"";   //如果i=n;那么menu[i].classname为now
		showdiv[i].style.display=i==n?"block":"none";   //如果如果i=n;那么showdiv[i].style.display为block"
	}
}


function showa(){
	
	
		 var speed=40
					 var demo=document.getElementById("demo");
					 var demo2=document.getElementById("demo2");
					 var demo1=document.getElementById("demo1");
					
					 demo2.innerHTML=demo1.innerHTML;
					 function Marquee(){
						 if(
						 demo2.offsetTop-demo.scrollTop<=0)
						 demo.scrollTop-=demo1.offsetHeightelse
						 {
						 demo.scrollTop++;
							 }
						 }
						 var MyMar=setInterval(Marquee,speed)
						 demo.onmouseover=function() 
						 {
							 clearInterval(MyMar)}
							 demo.onmouseout=function() 
						 {
							 MyMar=setInterval(Marquee,speed)}
	}
	
	
	function ScrollLeft(obj){

					var speed=20;
					var tab=document.getElementById(obj);
					var tab1=document.getElementById(obj+"1");
					var tab2=document.getElementById(obj+"2");
					tab2.innerHTML=tab1.innerHTML;
					function Marquee(){
						if(tab2.offsetWidth-tab.scrollLeft<=0)
						tab.scrollLeft-=tab1.offsetWidth
						else{
						tab.scrollLeft++;
						}
					}
					var MyMar=setInterval(Marquee,speed);
					tab.onmouseover=function() {clearInterval(MyMar)};
					tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
				}

	
	
	
/*	function go_Top(){
	$('#go_Top').hide();
	var _clientHeight = document.documentElement.clientHeight;
	$(window).scroll(function(){
		if($(window).scrollTop()>160)
		{
			$('#go_Top').show();
			if($('#go_Top').css('position')=='absolute')
			{
				$("#go_Top").stop();
				$("#go_Top").animate({top:_clientHeight-200+$(window).scrollTop()},'slow');
			}
		}
		else
		{
			$('#go_Top').hide();
		}
	})
}*/

function go_Top(){
	$('#go_Top').hide();
	var _clientHeight = document.documentElement.clientHeight;
	$(window).scroll(function(){
		if($(window).scrollTop()>160)
		{
			$('#go_Top').show();
			if($('#go_Top').css('position')=='absolute')
			{
				$("#go_Top").stop();
				$("#go_Top").animate({top:_clientHeight-200+$(window).scrollTop()},'slow');
			}
		}
		else
		{
			$('#go_Top').hide();
		}
	})
}

